//
// Created by xili on 2024/8/21 19:53.
// GO BIG OR GO HOME.
//
#include "leetcode.h"

class Solution {
public:
    int numberOfMatches(int n) {
        int ans = 0;
        while (n > 1) {
            int t = n & 1;
            ans += (n - t) / 2;
            n = (n - t) / 2 + t;
        }
        return ans;
    }
};